real function numerator(a,n,avex)
    dimension a(n)
    integer i,n
    numerator=0

    do 20, i=1,n
        numerator=numerator+abs((avex-a(i))**3)
    20 continue

end function

real function denorminator(a,n,avex)
    dimension a(n)
    integer i,n
    denorminator=0

    do 30, i=1,n
        denorminator=denorminator+(avex-a(i))**2
    30 continue

    denorminator=(sqrt(denorminator/(n-1)))**3*n
end function

real function std(a,n,avex)
    dimension a(n)
    integer i,n
    std=0
    do i=1,n
        std=std+(avex-a(i))**2
    end do
    std=sqrt(std/(n-1))
end function

program chapter11_4
    implicit none
    integer n,i
    real numerator,denorminator,std
    real a(15)
    real s,avex
    parameter (n=15)
    i=1
    s=0
    !data array
    data a/10.93, 12.63, 13.51,10.60, 11.25, 12.32, 11.56, 11.89, 10.82, 12.36, 11.09, 12.53, 10.76, 11.87, 12.05/
    !sum s
    do i=i,n
        s=s+a(i)
    end do
    avex=s/n

    print *, 'average of x=',avex
    print *,'numerator=',numerator(a,n,avex)
    print *, 'denorminator=',denorminator(a,n,avex)
    print *,'standard devision=',std(a,n,avex)
    print*, 'outcome=', numerator(a,n,avex)/denorminator(a,n,avex)

    print *,''
    print *,'In scientific notation format'
    write(*, 10) std(a,n,avex)
    write(*, 20) numerator(a,n,avex)/denorminator(a,n,avex)

10 format (1x,'standard devision=',e16.8)
20 format (1x,'outcome=',e16.8)
end program

